<template>
  <div id="write" v-on:keydown.ctrl.s="saveFile" tabindex="1">
        <file-tree v-on:fileSelected="fileSelected"
         v-on:reopen="reopen"
         v-on:saveFile="saveFile"
          v-show="show"></file-tree>
        <editor-tab ref="editortab"></editor-tab>
  </div>
</template>

<script>
import FileTree from "./part/FileTree"
import EditorTab from "./part/EditorTab"

export default {
  data() {
    return {
      show: true
    }
  },
  components:{ FileTree, EditorTab },
  methods: {
    fileSelected(item) {
      // 让编辑栏知道打开一个新文件。
      this.$refs.editortab.showfile(item)
    },
    reopen() {
      this.$refs.editortab.closeAll()
    },
    saveFile() {
      this.$refs.editortab.saveFile()
    },
    toggle() {
      this.show = !this.show
    }
  }
}

</script>
<style scoped>
#write{
  height:100%;
  overflow:hidden;
	display:flex;
  outline:none;
}
</style>
